export function mergeObject(current, target) {
	if (target instanceof Object) {
		if (JSON.stringify(target) == "{}") return current = {}
		for (let key in target) {
			if (typeof target[key] == "object") {
				if (!current[key]) current[key] = {}
				mergeObject(current[key], target[key])
			} else if (typeof target[key] == "array") {
				if (!current[key]) current[key] = []
				mergeObject(current[key], target[key])
			} else {
				current[key] = target[key]
			}
		}
	} else if (target instanceof Array) {
		if (JSON.stringify(target) == "[]") return current = []
		target.forEach((item, index) => {
			if (typeof item == "object") {
				mergeObject(current[index], target[index])
			} else if (typeof item == "array") {
				if (!current[index]) current[index] = []
				mergeObject(current[index], target[index])
			} else {
				current[index] = target[index]
			}
		})
	}else{
		throw("参数类型不正确，参数必须是数组或对象")
	}
}
export default {
	mergeObject,
}
